package com.fengqianrun.java.controller;

import com.aizuda.easy.security.exp.impl.BasicException;
import com.aizuda.easy.security.handler.RepFunctionHandler;
import com.aizuda.easy.security.handler.ReqFunctionHandler;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Component
public class CustomHandler implements ReqFunctionHandler, RepFunctionHandler {

    /**
     * 可以对在请求的过程中 对 request 和 json 内容进行相应的处理
     * @param request
     * @param json
     * @return
     * @throws BasicException
     * @throws IOException
     */
    @Override
    public String exec(HttpServletRequest request, String json) throws BasicException, IOException {
        System.out.println("1111111111");
        return json;
    }

    @Override
    public Integer getIndex() {
        return 10;
    }

    /**
     * 可以对在相应的过程中 对 response 和 json 内容进行相应的处理
     * @param response
     * @param json
     * @return
     * @throws BasicException
     * @throws IOException
     */
    @Override
    public String exec(HttpServletResponse response, String json) throws BasicException, IOException {
        System.out.println("222222222");
        return json;
    }
}
